//
//  NewActionContent.m
//  TestApplication
//
//  Created by Hanlingyu on 16/09/03
//  Copyright (c) ltq. All rights reserved.
//

#import "NewActionContent.h"
#import "NewActionImg.h"
#import "NewActionChannel.h"
#import "NewActionTagModel.h"
#import "NewActionOfCommentModel.h"
@implementation NewActionContent

- (void)setValue:(id)value forKey:(NSString *)key {
    
    [super setValue:value forKey:key];
    if ([key isEqualToString:@"img"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            NewActionImg *actionImage = [NewActionImg modelWithDic:dic];
            [array addObject:actionImage];
        }
        _img = array;
    } else if ([key isEqualToString:@"channel"]) {
        NewActionChannel *newChannel = [NewActionChannel modelWithDic:value];
        _channel = newChannel;
    } else if ([key isEqualToString:@"tag"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            NewActionTagModel *tagModel = [NewActionTagModel modelWithDic:dic];
            [array addObject:tagModel];
        }
        _tag = array;
    } else if ([key isEqualToString:@"hotComments"]) {
        NSMutableArray *array = [NSMutableArray array];
        for (NSDictionary *dic in value) {
            NewActionOfCommentModel *commentModel = [NewActionOfCommentModel modelWithDic:dic];
            [array addObject:commentModel];
        }
        _hotComments = array;
    }
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    [super setValue:value forUndefinedKey:key];
    if ([key isEqualToString:@"id"]) {
        _ID = value;
    }
}

+ (NSDictionary *)objectClassInArray{
    return @{@"img" : [NewActionImg class]};
}

@end
